/*
 *  clb_platform_info.c
 *  clbench
 *
 *  Created by Holmes Futrell on 12/16/09.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */

#include "clb_platform_info.h"
#include "clb_error.h"

#include <stdio.h>
#include <stdlib.h>

static void print_platform_info_string( cl_platform_id platform_id, cl_platform_info param_name, const char *s ) {

	char buffer[2048];
	size_t size;
	
	cl_int err = clb_check_error( clGetPlatformInfo( platform_id, param_name, sizeof(buffer), buffer, &size), "clGetPlatformInfo");
				 
	if (err == CL_SUCCESS) {
		printf("%s: %s\n", s, buffer);
	}
	
}

void getPlatformInfo(cl_platform_id platform_id) {

	print_platform_info_string( platform_id, CL_PLATFORM_PROFILE,		"CL_PLATFORM_PROFILE" );
	print_platform_info_string( platform_id, CL_PLATFORM_VERSION,		"CL_PLATFORM_VERSION" );
	print_platform_info_string( platform_id, CL_PLATFORM_NAME,			"CL_PLATFORM_NAME" );
	print_platform_info_string( platform_id, CL_PLATFORM_VENDOR,		"CL_PLATFORM_VENDOR" );
	print_platform_info_string( platform_id, CL_PLATFORM_EXTENSIONS,	"CL_PLATFORM_EXTENSIONS" );
	printf("\n");
	
}